package com.kx.demo.concurrent;

/**
 * @author kx
 * @date 2020/4/12
 */
public class ThreadDemo {

    static class MyThread extends Thread {

        @Override
        public void run() {
            System.out.println("继承 Thread");
            super.run();
        }
    }

    static class MyRunnable implements Runnable {

        @Override
        public void run() {
            System.out.println("继承 runnable");
        }
    }

    public static void main(String[] args) {

        new Thread(new Runnable() {

            @Override
            public void run() {
                System.out.println("内部实现 run");
            }
        }).start();

        new Thread() {
            @Override
            public void run() {
                System.out.println("内部重载 run");
            }
        }.start();

        MyThread myThread = new MyThread();
        myThread.start();
        myThread.start();

        new Thread(new MyRunnable()).start();
    }

}
